package com.fitzone.web.controller.admin;

import com.fitzone.common.context.UserContext;
import com.fitzone.common.result.Result;
import com.fitzone.model.entity.User;
import com.fitzone.web.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/user")
@RequiredArgsConstructor
@Api(tags = "生成二维码")
public class UserController {
    private final UserService userService;

    @PostMapping("/scanQrcode")
    @ApiOperation("门店通过扫描二维码来识别用户是否存在")
    public Result scanQrcode(){
        Long currentId = UserContext.getCurrentId();
        User user = userService.getById(currentId);
        return Result.ok(user);
    }
}
